<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');
if (isEmpty(getParam('ID'))) {
    echo 'WRONG PARAMETER';
} else {
    $mEntity = unserialize($_SESSION['mEntity']);

    $rows = $db->query_select($mEntity->table, sprintf("ID='%s'", getParam('ID')));
    foreach ($rows as $row) {
        ?>
        <form id="<?php echo $mEntity->formName; ?>" name="<?php echo $mEntity->formName; ?>" method="get" action="<?php echo $mEntity->updateUrlPage; ?>">
            <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th scope="col"><legend>DATOS ENTIDAD</legend></th>
                    <th scope="col" valign="middle"><legend>
                        <div class="btn-group" style="margin-left: 30%"> 
                            <input type="button" name="cmdOk" id="cmdOk" value="Modificar" class="btn btn-info" onclick="javascript:formOkBt($(this.form),updateAction);" />
                            <input type="button" name="eliminar" id="" class="btn btn-info" value="Eliminar" onclick="javascript:deleteAction('<?php echo $mEntity->deleteUrlPage; ?>',<?php echo $mEntity->getDeleteUrl(); ?>)" />        
                            <input type="button" name="cmdCancel" id="cmdCancel" class="btn btn-info" value="Cancelar" onClick="loadTable();jQuery('#cmAddcontainer').show();" />
                        </div></legend>      
                    </th>
                </tr>
                <tr>
                    <td colspan="2"><br/><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td width="20%">NOMBRE</td>
                                <td width="80%">            <input name="NAME" type="text" value="<?php echo $row['NAME']; ?>" id="NAME" /></td>
                            </tr>
                            <tr>
                                <td>DESCRIPCION</td>
                                <td>            <input name="LONG_DESCRIPCION" type="text" id="LONG_DESCRIPCION" value="<?php echo $row['LONG_DESCRIPCION']; ?>" />          </td>
                            </tr>

                            <tr>
                                <td>ESTATUS</td>
                                <td><select name="STATUS" id="STATUS">
                                        <option value="1" <?php
        if (!(strcmp(1, $row['STATUS']))) {
            echo "selected=\"selected\"";
        }
        ?>>ACTIVA</option>
                                        <option value="0" <?php
        if (!(strcmp(0, $row['STATUS']))) {
            echo "selected=\"selected\"";
        }
        ?>>INACTIVA</option>
                                    </select>
                                    <input name="STATUS" type="hidden" id="STATUS" value="<?php echo $row['STATUS']; ?>" />
                                    <input name="ID" type="hidden" id="ID" value="<?PHP echo getParam('ID'); ?>" /></td>
                            </tr>
                        </table></td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
            </table>
        </form>

        <?php
    }
}
?>
